//
//  Configuration.h
//  Mockup
//
//  Created by Bernardo Quibiana on 2/20/10.
//  Copyright 2010 Mac-Easy@USC. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Utils.h"
#import "Matrix.h"

@interface Configuration : NSObject {
	NSMutableDictionary * settings;
	Matrix * highScores;
}

@property (nonatomic, retain) NSMutableDictionary * settings;
@property (nonatomic, retain) Matrix * highScores;

+(Configuration *) sharedInstance;
+(void) killSharedInstance;

// load the settings from the settings plist
-(void) loadSettings;
// load the high scores from the high scores plist
-(void) loadHighScores;
// save the settings into the settings plist
-(void) saveSettings;
+(void) saveSettings;
// save the highscores into the high scores plist
-(void) saveHighScores;
+(void) saveHighScores;

// check if there is a saved game
-(BOOL) savedGame;
+(BOOL) savedGame;
-(void) didSaveGame:(BOOL) saved;
+(void) didSaveGame:(BOOL) saved;

+(NSString *) getSavedGameFile;

-(void) setPreferredDifficulty:(difficulty_t) difficulty;
-(difficulty_t) getPreferredDifficulty;
+(void) setPreferredDifficulty:(difficulty_t) difficulty;
+(difficulty_t) getPreferredDifficulty;

// generic way to access setting values
-(id) getSettingsValueForKey:(NSString *) key;

// get a matrix with high scores for a given difficulty
-(Matrix *) getHighScoresForDifficulty: (difficulty_t) difficulty;

// check the potential position of the given high score among the high scores of a given difficulty
-(NSInteger) checkHighScoreForDifficulty:(difficulty_t) difficulty withScore:(NSInteger) score;

// inserts the given high score info into the high scores for the given difficulty depending on current values
-(BOOL) updateHighScoresForDifficulty: (difficulty_t) difficulty withName:(NSString *)username andScore: (NSInteger) score;

-(NSArray *) scoresForDifficulty:(difficulty_t) difficulty;
-(NSInteger) getMinIndexForDifficulty:(difficulty_t) difficulty;
@end
